<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCrmCompanyTable extends Migration
{
    /**
     * Run the migrations.
     * crm 企业公共表
     * @return void
     */
    public function up()
    {
        Schema::create('crm_company', function (Blueprint $table) {
            $table->engine = 'MyISAM';
            $table->comment='crm 企业公共表';
            $table->increments('id')->unsigned()->comment('自增键');
            $table->string('name',100)->default('')->comment('企业名称');
            $table->string('adress',200)->default('')->comment('地址');
            $table->string('contacts',25)->default('')->comment('企业负责人');
            $table->string('phone',20)->default('')->comment('座机');
            $table->string('mobile',11)->unsigned()->index('mobile')->default(0)->comment('手机');
            $table->string('email',60)->default('')->comment('邮箱');
            $table->string('web',250)->default('')->comment('网址');
            $table->tinyInteger('level')->unsigned()->default(0)->comment('0默认无，2.成交客户，4意向客户，6潜在客户，8需求跟进客气 ，10初步洽谈客户');
            $table->string('remarks',1000)->default('')->comment('备注');
            $table->integer('crm_uid')->index('crm_uid')->default(0)->comment('销售关联uid');
            $table->timestamp('last_call_time')->index('last_call_time')->comment('最后通话时间');
            $table->integer('com_uid')->index('com_uid')->unsigned()->default(0)->comment('关联企业注册com_id');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('crm_company');
    }
}
